package game;

public abstract class Entity {
    /** current x (swing coordinate system) */
    protected float x;
    /** current y (swing coordinate system) */
    protected float y;
    /** current velocity */
    protected float velocity;
    /** Acceleration per frame */
    protected float acceleration;
    /** The current direction the entity is going */
    protected double angle;
    /** Restrictions on where entity can go */
    protected Boundary bounds;
    
    public int getX() {
	return (int) x;
    }
    
    public int getY() {
	return (int) y;
    }
    
    /** updates the entity 1 frame */
    public abstract void update();
    
    public double getAngle() {
	return angle;
    }
    
    public void setAngle() {
	
    }
    /**
     * 
     * @param x Initial x coordinate (swing)
     * @param y Initial y coordinate (swing)
     * @param bounds boundary restrictions
     */
    
    public Entity(float x, float y, Boundary bounds) {
	this.x = x;
	this.y = y;
	this.bounds = bounds;
    }
    
    /** Returns true if entity can continue at current velocity */
    public boolean canMove() {
	return !bounds.isOutOfBounds((int)(Math.cos(angle)*velocity+x), (int)(Math.sin(angle)*velocity+y));
    }
    
    public boolean canMoveX() {
	return !bounds.isOutOfBounds((int)(Math.cos(angle)*velocity+x),(int)y);
    }
    
    public boolean canMoveY() {
	return !bounds.isOutOfBounds((int)x,(int)(Math.sin(angle)*velocity + y));
    }

    public float getVelocity() {
        return velocity;
    }

    public void setVelocity(float velocity) {
        this.velocity = velocity;
    }

    public float getAcceleration() {
        return acceleration;
    }

    public void setAcceleration(float acceleration) {
        this.acceleration = acceleration;
    }

    public Boundary getBounds() {
        return bounds;
    }

    public void setBounds(Boundary bounds) {
        this.bounds = bounds;
    }

    public void setX(float x) {
        this.x = x;
    }

    public void setY(float y) {
        this.y = y;
    }

    public void setAngle(double angle) {
        this.angle = angle;
    }
    
    public double getCollisionRadius;
    
}
